package org.lmind.example.util.io;

import java.io.Closeable;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;

/**
 * 表示一个受限文件
 * @author mian.liu
 *
 */
public interface RestrictedFile extends Closeable {

	/**
	 * 文件的字节大小,如果无法获取大小,返回-1
	 * @return
	 * @throws IOException
	 */
	long getSize() throws IOException;
	
	/**
	 * 从文件指定偏移量打开一个InputStream
	 * @param offset
	 * @param length
	 * @return
	 * @throws IOException
	 */
	InputStream openInputStream(long offset, long length) throws IOException;
	
	/**
	 * 从文件指定偏移量打开一个OutputStream
	 * @param offset
	 * @param length
	 * @return
	 * @throws IOException
	 */
	OutputStream openOutputStream(long offset, long length) throws IOException;
}
